package coreconcurrency.unsafe;

import coreconcurrency.entity.Account;

/**
 * create by yongli on 2021-11-27 16:10
 * 用于操作用户账号的类/对象
 * 用静态类方法，有点面向过程设计，使用对象，比较丝滑
 */

public class AccountOperation {

    public static void add(Account account, double num) {
        account.setNumber(account.getNumber() + num);
    }

    public static void sub(Account account, double num) {
        account.setNumber(account.getNumber() - num);
    }

    public static void increment(Account account) {
        account.setNumber(account.getNumber() + 1);
    }
}
